home *** CD-ROM | disk | FTP | other *** search
/ Freelog 121 / FreelogMagazineJuilletAout2014-No121.iso / Outils / Adobe-Air / adobe-air_13.exe / [0] / setup.swf / scripts / mx / containers / FormItem.as < prev    next >
Text File  |  2014-03-27  |  34KB  |  989 lines

  1. package mx.containers
  2. {
  3.    import flash.display.DisplayObject;
  4.    import flash.events.Event;
  5.    import mx.containers.utilityClasses.BoxLayout;
  6.    import mx.containers.utilityClasses.Flex;
  7.    import mx.controls.FormItemLabel;
  8.    import mx.controls.Label;
  9.    import mx.core.Container;
  10.    import mx.core.EdgeMetrics;
  11.    import mx.core.FlexVersion;
  12.    import mx.core.IFlexDisplayObject;
  13.    import mx.core.IUIComponent;
  14.    import mx.core.ScrollPolicy;
  15.    import mx.core.mx_internal;
  16.    import mx.styles.CSSStyleDeclaration;
  17.    import mx.styles.StyleManager;
  18.    
  19.    use namespace mx_internal;
  20.    
  21.    public class FormItem extends Container
  22.    {
  23.       
  24.       mx_internal static const VERSION:String = "3.0.0.0";
  25.        
  26.       
  27.       private var _direction:String = "vertical";
  28.       
  29.       private var guessedNumColumns:int;
  30.       
  31.       private var _required:Boolean = false;
  32.       
  33.       mx_internal var verticalLayoutObject:BoxLayout;
  34.       
  35.       private var labelChanged:Boolean = false;
  36.       
  37.       private var guessedRowWidth:Number;
  38.       
  39.       private var labelObj:Label;
  40.       
  41.       private var numberOfGuesses:int = 0;
  42.       
  43.       private var indicatorObj:IFlexDisplayObject;
  44.       
  45.       private var _label:String = "";
  46.       
  47.       public function FormItem()
  48.       {
  49.          verticalLayoutObject = new BoxLayout();
  50.          super();
  51.          _horizontalScrollPolicy = ScrollPolicy.OFF;
  52.          _verticalScrollPolicy = ScrollPolicy.OFF;
  53.          mx_internal::verticalLayoutObject.target = this;
  54.          mx_internal::verticalLayoutObject.direction = BoxDirection.VERTICAL;
  55.       }
  56.       
  57.       override public function styleChanged(param1:String) : void
  58.       {
  59.          var _loc3_:String = null;
  60.          var _loc4_:CSSStyleDeclaration = null;
  61.          super.styleChanged(param1);
  62.          var _loc2_:Boolean = param1 == null || param1 == "styleName";
  63.          if(_loc2_ || param1 == "labelStyleName")
  64.          {
  65.             if(labelObj)
  66.             {
  67.                _loc3_ = getStyle("labelStyleName");
  68.                if(_loc3_)
  69.                {
  70.                   if(_loc4_ = StyleManager.getStyleDeclaration("." + _loc3_))
  71.                   {
  72.                      labelObj.styleDeclaration = _loc4_;
  73.                      labelObj.regenerateStyleCache(true);
  74.                   }
  75.                }
  76.             }
  77.          }
  78.       }
  79.       
  80.       mx_internal function getHorizontalAlignValue() : Number
  81.       {
  82.          var _loc1_:String = getStyle("horizontalAlign");
  83.          if(_loc1_ == "center")
  84.          {
  85.             return 0.5;
  86.          }
  87.          if(_loc1_ == "right")
  88.          {
  89.             return 1;
  90.          }
  91.          return 0;
  92.       }
  93.       
  94.       private function calcNumColumns(param1:Number) : int
  95.       {
  96.          var _loc7_:IUIComponent = null;
  97.          var _loc8_:Number = NaN;
  98.          var _loc2_:Number = 0;
  99.          var _loc3_:Number = 0;
  100.          var _loc4_:Number = getStyle("horizontalGap");
  101.          if(direction != FormItemDirection.HORIZONTAL)
  102.          {
  103.             return 1;
  104.          }
  105.          var _loc5_:Number = numChildren;
  106.          var _loc6_:int = 0;
  107.          while(_loc6_ < numChildren)
  108.          {
  109.             if(!(_loc7_ = IUIComponent(getChildAt(_loc6_))).includeInLayout)
  110.             {
  111.                _loc5_--;
  112.             }
  113.             else
  114.             {
  115.                _loc8_ = _loc7_.getExplicitOrMeasuredWidth();
  116.                _loc3_ = Math.max(_loc3_,_loc8_);
  117.                _loc2_ += _loc8_;
  118.                if(_loc6_ > 0)
  119.                {
  120.                   _loc2_ += _loc4_;
  121.                }
  122.             }
  123.             _loc6_++;
  124.          }
  125.          if(isNaN(param1) || _loc2_ <= param1)
  126.          {
  127.             return _loc5_;
  128.          }
  129.          if(_loc3_ * 2 <= param1)
  130.          {
  131.             return 2;
  132.          }
  133.          return 1;
  134.       }
  135.       
  136.       override protected function commitProperties() : void
  137.       {
  138.          super.commitProperties();
  139.          if(labelChanged)
  140.          {
  141.             labelObj.text = label;
  142.             labelObj.validateSize();
  143.             labelChanged = false;
  144.          }
  145.       }
  146.       
  147.       mx_internal function get labelObject() : Object
  148.       {
  149.          return labelObj;
  150.       }
  151.       
  152.       private function previousUpdateDisplayList(param1:Number, param2:Number) : void
  153.       {
  154.          var _loc10_:int = 0;
  155.          var _loc11_:IUIComponent = null;
  156.          var _loc12_:Number = NaN;
  157.          var _loc13_:Number = NaN;
  158.          var _loc14_:Number = NaN;
  159.          var _loc15_:Number = NaN;
  160.          var _loc16_:Number = NaN;
  161.          var _loc19_:Number = NaN;
  162.          var _loc20_:int = 0;
  163.          var _loc21_:Number = NaN;
  164.          var _loc22_:int = 0;
  165.          var _loc23_:Number = NaN;
  166.          var _loc24_:Number = NaN;
  167.          var _loc25_:Number = NaN;
  168.          var _loc26_:Number = NaN;
  169.          super.updateDisplayList(param1,param2);
  170.          var _loc3_:EdgeMetrics = viewMetricsAndPadding;
  171.          var _loc4_:Number = _loc3_.left;
  172.          var _loc5_:Number;
  173.          var _loc6_:Number = _loc5_ = _loc3_.top;
  174.          var _loc7_:Number = calculateLabelWidth();
  175.          var _loc8_:Number = getStyle("indicatorGap");
  176.          var _loc9_:String;
  177.          if((_loc9_ = getStyle("horizontalAlign")) == "right")
  178.          {
  179.             _loc16_ = 1;
  180.          }
  181.          else if(_loc9_ == "center")
  182.          {
  183.             _loc16_ = 0.5;
  184.          }
  185.          else
  186.          {
  187.             _loc16_ = 0;
  188.          }
  189.          var _loc17_:int;
  190.          if((_loc17_ = numChildren) > 0)
  191.          {
  192.             _loc12_ = (_loc11_ = IUIComponent(getChildAt(0))).baselinePosition;
  193.             if(!isNaN(_loc12_))
  194.             {
  195.                _loc6_ += _loc12_ - labelObj.baselinePosition;
  196.             }
  197.          }
  198.          labelObj.setActualSize(_loc7_,labelObj.getExplicitOrMeasuredHeight());
  199.          labelObj.move(_loc4_,_loc6_);
  200.          _loc4_ += _loc7_;
  201.          displayIndicator(_loc4_,_loc6_);
  202.          _loc4_ += _loc8_;
  203.          var _loc18_:Number;
  204.          if((_loc18_ = param1 - _loc3_.right - _loc4_) < 0)
  205.          {
  206.             _loc18_ = 0;
  207.          }
  208.          if(direction == FormItemDirection.HORIZONTAL)
  209.          {
  210.             _loc19_ = 0;
  211.             _loc20_ = calcNumColumns(_loc18_);
  212.             _loc22_ = 0;
  213.             _loc14_ = getStyle("horizontalGap");
  214.             _loc15_ = getStyle("verticalGap");
  215.             if(_loc20_ != guessedNumColumns && numberOfGuesses == 0)
  216.             {
  217.                guessedRowWidth = _loc18_;
  218.                numberOfGuesses = 1;
  219.                invalidateSize();
  220.             }
  221.             else
  222.             {
  223.                numberOfGuesses = 0;
  224.             }
  225.             if(_loc20_ == _loc17_)
  226.             {
  227.                _loc23_ = height - (_loc5_ + _loc3_.bottom);
  228.                _loc24_ = Flex.flexChildWidthsProportionally(this,_loc18_ - (_loc17_ - 1) * _loc14_,_loc23_);
  229.                _loc4_ += _loc24_ * _loc16_;
  230.                _loc10_ = 0;
  231.                while(_loc10_ < _loc17_)
  232.                {
  233.                   (_loc11_ = IUIComponent(getChildAt(_loc10_))).move(Math.floor(_loc4_),_loc5_);
  234.                   _loc4_ += _loc11_.width + _loc14_;
  235.                   _loc10_++;
  236.                }
  237.             }
  238.             else
  239.             {
  240.                _loc10_ = 0;
  241.                while(_loc10_ < _loc17_)
  242.                {
  243.                   _loc11_ = IUIComponent(getChildAt(_loc10_));
  244.                   _loc19_ = Math.max(_loc19_,_loc11_.getExplicitOrMeasuredWidth());
  245.                   _loc10_++;
  246.                }
  247.                if((_loc25_ = _loc18_ - (_loc20_ * _loc19_ + (_loc20_ - 1) * _loc14_)) < 0)
  248.                {
  249.                   _loc25_ = 0;
  250.                }
  251.                _loc21_ = _loc4_ += _loc25_ * _loc16_;
  252.                _loc10_ = 0;
  253.                while(_loc10_ < _loc17_)
  254.                {
  255.                   _loc11_ = IUIComponent(getChildAt(_loc10_));
  256.                   _loc13_ = Math.min(_loc19_,_loc11_.getExplicitOrMeasuredWidth());
  257.                   _loc11_.setActualSize(_loc13_,_loc11_.getExplicitOrMeasuredHeight());
  258.                   _loc11_.move(_loc21_,_loc5_);
  259.                   if(++_loc22_ >= _loc20_)
  260.                   {
  261.                      _loc21_ = _loc4_;
  262.                      _loc22_ = 0;
  263.                      _loc5_ += _loc11_.height + _loc15_;
  264.                   }
  265.                   else
  266.                   {
  267.                      _loc21_ += _loc19_ + _loc14_;
  268.                   }
  269.                   _loc10_++;
  270.                }
  271.             }
  272.          }
  273.          else
  274.          {
  275.             _loc15_ = getStyle("verticalGap");
  276.             _loc10_ = 0;
  277.             while(_loc10_ < _loc17_)
  278.             {
  279.                _loc11_ = IUIComponent(getChildAt(_loc10_));
  280.                if(!isNaN(_loc11_.percentWidth))
  281.                {
  282.                   _loc13_ = Math.floor(_loc18_ * Math.min(_loc11_.percentWidth,100) / 100);
  283.                }
  284.                else
  285.                {
  286.                   _loc13_ = _loc11_.getExplicitOrMeasuredWidth();
  287.                   if(isNaN(_loc11_.explicitWidth))
  288.                   {
  289.                      if(_loc13_ < Math.floor(_loc18_ * 0.25))
  290.                      {
  291.                         _loc13_ = Math.floor(_loc18_ * 0.25);
  292.                      }
  293.                      else if(_loc13_ < Math.floor(_loc18_ * 0.5))
  294.                      {
  295.                         _loc13_ = Math.floor(_loc18_ * 0.5);
  296.                      }
  297.                      else if(_loc13_ < Math.floor(_loc18_ * 0.75))
  298.                      {
  299.                         _loc13_ = Math.floor(_loc18_ * 0.75);
  300.                      }
  301.                      else if(_loc13_ < Math.floor(_loc18_))
  302.                      {
  303.                         _loc13_ = Math.floor(_loc18_);
  304.                      }
  305.                   }
  306.                }
  307.                _loc11_.setActualSize(_loc13_,_loc11_.getExplicitOrMeasuredHeight());
  308.                _loc26_ = (_loc18_ - _loc13_) * _loc16_;
  309.                _loc11_.move(_loc4_ + _loc26_,_loc5_);
  310.                _loc5_ = (_loc5_ += _loc11_.height) + _loc15_;
  311.                _loc10_++;
  312.             }
  313.          }
  314.          _loc6_ = _loc3_.top;
  315.          if(_loc17_ > 0)
  316.          {
  317.             _loc12_ = (_loc11_ = IUIComponent(getChildAt(0))).baselinePosition;
  318.             if(!isNaN(_loc12_))
  319.             {
  320.                _loc6_ += _loc12_ - labelObj.baselinePosition;
  321.             }
  322.          }
  323.          labelObj.move(labelObj.x,_loc6_);
  324.       }
  325.       
  326.       override protected function createChildren() : void
  327.       {
  328.          var _loc1_:String = null;
  329.          var _loc2_:CSSStyleDeclaration = null;
  330.          super.createChildren();
  331.          if(!labelObj)
  332.          {
  333.             labelObj = new FormItemLabel();
  334.             _loc1_ = getStyle("labelStyleName");
  335.             if(_loc1_)
  336.             {
  337.                _loc2_ = StyleManager.getStyleDeclaration("." + _loc1_);
  338.                if(_loc2_)
  339.                {
  340.                   labelObj.styleDeclaration = _loc2_;
  341.                }
  342.             }
  343.             rawChildren.addChild(labelObj);
  344.             dispatchEvent(new Event("itemLabelChanged"));
  345.          }
  346.       }
  347.       
  348.       function getPreferredLabelWidth() : Number
  349.       {
  350.          if(!label || label == "")
  351.          {
  352.             return 0;
  353.          }
  354.          if(isNaN(labelObj.measuredWidth))
  355.          {
  356.             labelObj.validateSize();
  357.          }
  358.          var _loc1_:Number = labelObj.measuredWidth;
  359.          if(isNaN(_loc1_))
  360.          {
  361.             return 0;
  362.          }
  363.          return _loc1_;
  364.       }
  365.       
  366.       override protected function measure() : void
  367.       {
  368.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  369.          {
  370.             previousMeasure();
  371.             return;
  372.          }
  373.          super.measure();
  374.          if(direction == FormItemDirection.VERTICAL)
  375.          {
  376.             measureVertical();
  377.          }
  378.          else
  379.          {
  380.             measureHorizontal();
  381.          }
  382.       }
  383.       
  384.       [Bindable("itemLabelChanged")]
  385.       public function get itemLabel() : Label
  386.       {
  387.          return labelObj;
  388.       }
  389.       
  390.       [Bindable("requiredChanged")]
  391.       public function get required() : Boolean
  392.       {
  393.          return _required;
  394.       }
  395.       
  396.       private function previousMeasure() : void
  397.       {
  398.          var _loc12_:Number = NaN;
  399.          var _loc13_:Number = NaN;
  400.          var _loc16_:int = 0;
  401.          var _loc17_:IUIComponent = null;
  402.          super.measure();
  403.          var _loc1_:int = guessedNumColumns = calcNumColumns(guessedRowWidth);
  404.          var _loc2_:Number = getStyle("horizontalGap");
  405.          var _loc3_:Number = getStyle("verticalGap");
  406.          var _loc4_:Number = getStyle("indicatorGap");
  407.          var _loc5_:int = 0;
  408.          var _loc6_:Number = 0;
  409.          var _loc7_:Number = 0;
  410.          var _loc8_:Number = 0;
  411.          var _loc9_:Number = 0;
  412.          var _loc10_:Number = 0;
  413.          var _loc11_:Number = 0;
  414.          _loc12_ = 0;
  415.          _loc13_ = 0;
  416.          var _loc14_:Number = 0;
  417.          var _loc15_:int = numChildren;
  418.          if(direction == FormItemDirection.HORIZONTAL && _loc1_ < _loc15_)
  419.          {
  420.             _loc16_ = 0;
  421.             while(_loc16_ < _loc15_)
  422.             {
  423.                _loc17_ = IUIComponent(getChildAt(_loc16_));
  424.                _loc14_ = Math.max(_loc14_,_loc17_.getExplicitOrMeasuredWidth());
  425.                _loc16_++;
  426.             }
  427.          }
  428.          _loc16_ = 0;
  429.          while(_loc16_ < _loc15_)
  430.          {
  431.             _loc17_ = IUIComponent(getChildAt(_loc16_));
  432.             if(_loc5_ < _loc1_)
  433.             {
  434.                _loc6_ += !isNaN(_loc17_.percentWidth) ? _loc17_.minWidth : _loc17_.getExplicitOrMeasuredWidth();
  435.                _loc7_ += _loc14_ > 0 ? _loc14_ : _loc17_.getExplicitOrMeasuredWidth();
  436.                if(_loc5_ > 0)
  437.                {
  438.                   _loc6_ += _loc2_;
  439.                   _loc7_ += _loc2_;
  440.                }
  441.                _loc8_ = Math.max(_loc8_,!isNaN(_loc17_.percentHeight) ? Number(_loc17_.minHeight) : Number(_loc17_.getExplicitOrMeasuredHeight()));
  442.                _loc9_ = Math.max(_loc9_,_loc17_.getExplicitOrMeasuredHeight());
  443.             }
  444.             _loc5_++;
  445.             if(_loc5_ >= _loc1_ || _loc16_ == _loc15_ - 1)
  446.             {
  447.                _loc10_ = Math.max(_loc10_,_loc6_);
  448.                _loc12_ = Math.max(_loc12_,_loc7_);
  449.                _loc11_ += _loc8_;
  450.                _loc13_ += _loc9_;
  451.                if(_loc16_ > 0)
  452.                {
  453.                   _loc11_ += _loc3_;
  454.                   _loc13_ += _loc3_;
  455.                }
  456.                _loc5_ = 0;
  457.                _loc6_ = 0;
  458.                _loc7_ = 0;
  459.                _loc8_ = 0;
  460.                _loc9_ = 0;
  461.             }
  462.             _loc16_++;
  463.          }
  464.          var _loc18_:Number = calculateLabelWidth() + _loc4_;
  465.          _loc10_ += _loc18_;
  466.          _loc12_ += _loc18_;
  467.          if(label != null && label != "")
  468.          {
  469.             _loc11_ = Math.max(_loc11_,labelObj.getExplicitOrMeasuredHeight());
  470.             _loc13_ = Math.max(_loc13_,labelObj.getExplicitOrMeasuredHeight());
  471.          }
  472.          var _loc19_:EdgeMetrics = viewMetricsAndPadding;
  473.          _loc11_ += _loc19_.top + _loc19_.bottom;
  474.          _loc10_ += _loc19_.left + _loc19_.right;
  475.          _loc13_ += _loc19_.top + _loc19_.bottom;
  476.          _loc12_ += _loc19_.left + _loc19_.right;
  477.          measuredMinWidth = _loc10_;
  478.          measuredMinHeight = _loc11_;
  479.          measuredWidth = _loc12_;
  480.          measuredHeight = _loc13_;
  481.       }
  482.       
  483.       private function measureHorizontal() : void
  484.       {
  485.          var _loc10_:Number = NaN;
  486.          var _loc12_:Number = NaN;
  487.          var _loc14_:int = 0;
  488.          var _loc16_:IUIComponent = null;
  489.          var _loc1_:int = guessedNumColumns = calcNumColumns(guessedRowWidth);
  490.          var _loc2_:Number = getStyle("horizontalGap");
  491.          var _loc3_:Number = getStyle("verticalGap");
  492.          var _loc4_:Number = getStyle("indicatorGap");
  493.          var _loc5_:Number = 0;
  494.          var _loc6_:Number = 0;
  495.          var _loc7_:Number = 0;
  496.          var _loc8_:Number = 0;
  497.          var _loc9_:Number = 0;
  498.          _loc10_ = 0;
  499.          var _loc11_:Number = 0;
  500.          _loc12_ = 0;
  501.          var _loc13_:Number = 0;
  502.          var _loc15_:int = 0;
  503.          if(_loc1_ < numChildren)
  504.          {
  505.             _loc14_ = 0;
  506.             while(_loc14_ < numChildren)
  507.             {
  508.                if((_loc16_ = IUIComponent(getChildAt(_loc14_))).includeInLayout)
  509.                {
  510.                   _loc13_ = Math.max(_loc13_,_loc16_.getExplicitOrMeasuredWidth());
  511.                }
  512.                _loc14_++;
  513.             }
  514.          }
  515.          var _loc17_:int = 0;
  516.          _loc14_ = 0;
  517.          while(_loc14_ < numChildren)
  518.          {
  519.             if((_loc16_ = IUIComponent(getChildAt(_loc14_))).includeInLayout)
  520.             {
  521.                _loc5_ += !isNaN(_loc16_.percentWidth) ? _loc16_.minWidth : _loc16_.getExplicitOrMeasuredWidth();
  522.                _loc6_ += _loc13_ > 0 ? _loc13_ : _loc16_.getExplicitOrMeasuredWidth();
  523.                if(_loc15_ > 0)
  524.                {
  525.                   _loc5_ += _loc2_;
  526.                   _loc6_ += _loc2_;
  527.                }
  528.                _loc7_ = Math.max(_loc7_,!isNaN(_loc16_.percentHeight) ? Number(_loc16_.minHeight) : Number(_loc16_.getExplicitOrMeasuredHeight()));
  529.                _loc8_ = Math.max(_loc8_,_loc16_.getExplicitOrMeasuredHeight());
  530.                _loc15_++;
  531.                if(_loc15_ >= _loc1_ || _loc14_ == numChildren - 1)
  532.                {
  533.                   _loc9_ = Math.max(_loc9_,_loc5_);
  534.                   _loc11_ = Math.max(_loc11_,_loc6_);
  535.                   _loc10_ += _loc7_;
  536.                   _loc12_ += _loc8_;
  537.                   if(_loc17_ > 0)
  538.                   {
  539.                      _loc10_ += _loc3_;
  540.                      _loc12_ += _loc3_;
  541.                   }
  542.                   _loc15_ = 0;
  543.                   _loc17_++;
  544.                   _loc5_ = 0;
  545.                   _loc6_ = 0;
  546.                   _loc7_ = 0;
  547.                   _loc8_ = 0;
  548.                }
  549.             }
  550.             _loc14_++;
  551.          }
  552.          var _loc18_:Number = calculateLabelWidth() + _loc4_;
  553.          _loc9_ += _loc18_;
  554.          _loc11_ += _loc18_;
  555.          if(label != null && label != "")
  556.          {
  557.             _loc10_ = Math.max(_loc10_,labelObj.getExplicitOrMeasuredHeight());
  558.             _loc12_ = Math.max(_loc12_,labelObj.getExplicitOrMeasuredHeight());
  559.          }
  560.          var _loc19_:EdgeMetrics = viewMetricsAndPadding;
  561.          _loc10_ += _loc19_.top + _loc19_.bottom;
  562.          _loc9_ += _loc19_.left + _loc19_.right;
  563.          _loc12_ += _loc19_.top + _loc19_.bottom;
  564.          _loc11_ += _loc19_.left + _loc19_.right;
  565.          measuredMinWidth = _loc9_;
  566.          measuredMinHeight = _loc10_;
  567.          measuredWidth = _loc11_;
  568.          measuredHeight = _loc12_;
  569.       }
  570.       
  571.       public function set required(param1:Boolean) : void
  572.       {
  573.          if(param1 != _required)
  574.          {
  575.             _required = param1;
  576.             invalidateDisplayList();
  577.             dispatchEvent(new Event("requiredChanged"));
  578.          }
  579.       }
  580.       
  581.       private function updateDisplayListVerticalChildren(param1:Number, param2:Number) : void
  582.       {
  583.          var _loc5_:IUIComponent = null;
  584.          var _loc3_:Number = calculateLabelWidth() + getStyle("indicatorGap");
  585.          if(!isNaN(explicitMinWidth))
  586.          {
  587.             _explicitMinWidth -= _loc3_;
  588.          }
  589.          else if(!isNaN(measuredMinWidth))
  590.          {
  591.             measuredMinWidth -= _loc3_;
  592.          }
  593.          mx_internal::verticalLayoutObject.updateDisplayList(param1 - _loc3_,param2);
  594.          if(!isNaN(explicitMinWidth))
  595.          {
  596.             _explicitMinWidth += _loc3_;
  597.          }
  598.          else if(!isNaN(measuredMinWidth))
  599.          {
  600.             measuredMinWidth += _loc3_;
  601.          }
  602.          var _loc4_:Number = numChildren;
  603.          var _loc6_:Number = 0;
  604.          while(_loc6_ < _loc4_)
  605.          {
  606.             _loc5_ = IUIComponent(getChildAt(_loc6_));
  607.             _loc5_.move(_loc5_.x + _loc3_,_loc5_.y);
  608.             _loc6_++;
  609.          }
  610.       }
  611.       
  612.       private function displayIndicator(param1:Number, param2:Number) : void
  613.       {
  614.          var _loc3_:Class = null;
  615.          if(required)
  616.          {
  617.             if(!indicatorObj)
  618.             {
  619.                _loc3_ = getStyle("indicatorSkin") as Class;
  620.                indicatorObj = IFlexDisplayObject(new _loc3_());
  621.                rawChildren.addChild(DisplayObject(indicatorObj));
  622.             }
  623.             indicatorObj.x = param1 + (getStyle("indicatorGap") - indicatorObj.width) / 2;
  624.             if(labelObj)
  625.             {
  626.                indicatorObj.y = param2 + (labelObj.getExplicitOrMeasuredHeight() - indicatorObj.measuredHeight) / 2;
  627.             }
  628.          }
  629.          else if(indicatorObj)
  630.          {
  631.             rawChildren.removeChild(DisplayObject(indicatorObj));
  632.             indicatorObj = null;
  633.          }
  634.       }
  635.       
  636.       override public function set label(param1:String) : void
  637.       {
  638.          _label = param1;
  639.          labelChanged = true;
  640.          invalidateProperties();
  641.          invalidateSize();
  642.          invalidateDisplayList();
  643.          if(parent is Form)
  644.          {
  645.             Form(parent).invalidateLabelWidth();
  646.          }
  647.          dispatchEvent(new Event("labelChanged"));
  648.       }
  649.       
  650.       private function updateDisplayListHorizontalChildren(param1:Number, param2:Number) : void
  651.       {
  652.          var _loc17_:int = 0;
  653.          var _loc18_:IUIComponent = null;
  654.          var _loc19_:Number = NaN;
  655.          var _loc20_:Number = NaN;
  656.          var _loc27_:Number = NaN;
  657.          var _loc28_:Number = NaN;
  658.          var _loc29_:Number = NaN;
  659.          var _loc30_:Number = NaN;
  660.          var _loc32_:Number = NaN;
  661.          var _loc33_:Number = NaN;
  662.          var _loc34_:Number = NaN;
  663.          var _loc35_:Number = NaN;
  664.          var _loc36_:Number = NaN;
  665.          var _loc37_:Number = NaN;
  666.          var _loc38_:Number = NaN;
  667.          var _loc39_:Boolean = false;
  668.          var _loc40_:Array = null;
  669.          var _loc41_:Number = NaN;
  670.          var _loc42_:* = undefined;
  671.          var _loc43_:* = undefined;
  672.          var _loc44_:* = undefined;
  673.          var _loc3_:EdgeMetrics = viewMetricsAndPadding;
  674.          var _loc4_:Number = calculateLabelWidth();
  675.          var _loc5_:Number = getStyle("indicatorGap");
  676.          var _loc6_:Number = getStyle("horizontalGap");
  677.          var _loc7_:Number = getStyle("verticalGap");
  678.          var _loc8_:Number = getStyle("paddingLeft");
  679.          var _loc9_:Number = getStyle("paddingTop");
  680.          var _loc10_:Number = getHorizontalAlignValue();
  681.          var _loc11_:Number = scaleX > 0 && scaleX != 1 ? Number(minWidth / Math.abs(scaleX)) : Number(minWidth);
  682.          var _loc12_:Number = scaleY > 0 && scaleY != 1 ? Number(minHeight / Math.abs(scaleY)) : Number(minHeight);
  683.          var _loc13_:Number = Math.max(param1,_loc11_) - _loc3_.left - _loc3_.right;
  684.          var _loc14_:Number = Math.max(param2,_loc12_) - _loc3_.top - _loc3_.bottom;
  685.          var _loc15_:Number = 0;
  686.          var _loc16_:Number;
  687.          if((_loc16_ = _loc13_ - _loc4_ - _loc5_) < 0)
  688.          {
  689.             _loc16_ = 0;
  690.          }
  691.          var _loc21_:int = calcNumColumns(_loc16_);
  692.          var _loc22_:int = 0;
  693.          if(_loc21_ != guessedNumColumns)
  694.          {
  695.             if(numberOfGuesses < 2)
  696.             {
  697.                guessedRowWidth = _loc16_;
  698.                ++numberOfGuesses;
  699.                invalidateSize();
  700.                return;
  701.             }
  702.             _loc21_ = guessedNumColumns;
  703.             numberOfGuesses = 0;
  704.          }
  705.          else
  706.          {
  707.             numberOfGuesses = 0;
  708.          }
  709.          var _loc23_:Number = _loc8_ + _loc4_ + _loc5_;
  710.          var _loc24_:Number = _loc9_;
  711.          var _loc25_:Number = _loc23_;
  712.          var _loc26_:Number = _loc24_;
  713.          var _loc31_:int = numChildren;
  714.          _loc17_ = 0;
  715.          while(_loc17_ < numChildren)
  716.          {
  717.             if(!IUIComponent(getChildAt(_loc17_)).includeInLayout)
  718.             {
  719.                _loc31_--;
  720.             }
  721.             _loc17_++;
  722.          }
  723.          if(_loc21_ == _loc31_)
  724.          {
  725.             _loc32_ = Flex.flexChildWidthsProportionally(this,_loc16_ - (_loc31_ - 1) * _loc6_,_loc14_);
  726.             _loc23_ += _loc32_ * _loc10_;
  727.             _loc17_ = 0;
  728.             while(_loc17_ < numChildren)
  729.             {
  730.                if((_loc18_ = IUIComponent(getChildAt(_loc17_))).includeInLayout)
  731.                {
  732.                   _loc18_.move(Math.floor(_loc23_),_loc24_);
  733.                   _loc23_ += _loc18_.width + _loc6_;
  734.                }
  735.                _loc17_++;
  736.             }
  737.          }
  738.          else
  739.          {
  740.             _loc17_ = 0;
  741.             while(_loc17_ < numChildren)
  742.             {
  743.                if((_loc18_ = IUIComponent(getChildAt(_loc17_))).includeInLayout)
  744.                {
  745.                   _loc27_ = _loc18_.getExplicitOrMeasuredWidth();
  746.                   _loc29_ = _loc18_.percentWidth;
  747.                   _loc19_ = !isNaN(_loc29_) ? Number(_loc29_ * _loc16_ / 100) : Number(_loc27_);
  748.                   _loc19_ = Math.max(_loc18_.minWidth,Math.min(_loc18_.maxWidth,_loc19_));
  749.                   _loc15_ = Math.max(_loc15_,_loc19_);
  750.                }
  751.                _loc17_++;
  752.             }
  753.             _loc15_ = Math.min(_loc15_,Math.floor((_loc16_ - (_loc21_ - 1) * _loc6_) / _loc21_));
  754.             if((_loc33_ = _loc16_ - (_loc21_ * _loc15_ + (_loc21_ - 1) * _loc6_)) < 0)
  755.             {
  756.                _loc33_ = 0;
  757.             }
  758.             _loc23_ += _loc33_ * _loc10_;
  759.             _loc34_ = 0;
  760.             _loc35_ = 0;
  761.             _loc36_ = 0;
  762.             _loc38_ = _loc37_ = _loc14_;
  763.             _loc22_ = 0;
  764.             _loc17_ = 0;
  765.             while(_loc17_ < numChildren)
  766.             {
  767.                if(!(_loc18_ = IUIComponent(getChildAt(_loc17_))).includeInLayout)
  768.                {
  769.                   if(_loc17_ == numChildren - 1)
  770.                   {
  771.                      _loc38_ -= _loc35_;
  772.                      if(_loc17_ != numChildren - 1)
  773.                      {
  774.                         _loc38_ -= _loc7_;
  775.                      }
  776.                      if(_loc35_ > 0 && _loc34_ > 0)
  777.                      {
  778.                         _loc34_ = Math.max(0,_loc34_ - 100 * _loc35_ / _loc37_);
  779.                      }
  780.                      _loc36_ += _loc34_;
  781.                      _loc35_ = 0;
  782.                      _loc34_ = 0;
  783.                      _loc22_ = 0;
  784.                   }
  785.                }
  786.                else
  787.                {
  788.                   if(!isNaN(_loc18_.percentHeight))
  789.                   {
  790.                      _loc34_ = Math.max(_loc34_,_loc18_.percentHeight);
  791.                   }
  792.                   else
  793.                   {
  794.                      _loc35_ = Math.max(_loc35_,_loc18_.getExplicitOrMeasuredHeight());
  795.                   }
  796.                   if(++_loc22_ >= _loc21_ || _loc17_ == numChildren - 1)
  797.                   {
  798.                      _loc38_ -= _loc35_;
  799.                      if(_loc17_ != numChildren - 1)
  800.                      {
  801.                         _loc38_ -= _loc7_;
  802.                      }
  803.                      if(_loc35_ > 0 && _loc34_ > 0)
  804.                      {
  805.                         _loc34_ = Math.max(0,_loc34_ - 100 * _loc35_ / _loc37_);
  806.                      }
  807.                      _loc36_ += _loc34_;
  808.                      _loc35_ = 0;
  809.                      _loc34_ = 0;
  810.                      _loc22_ = 0;
  811.                   }
  812.                }
  813.                _loc17_++;
  814.             }
  815.             _loc39_ = false;
  816.             _loc40_ = new Array(numChildren);
  817.             _loc17_ = 0;
  818.             while(_loc17_ < numChildren)
  819.             {
  820.                _loc40_[_loc17_] = -1;
  821.                _loc17_++;
  822.             }
  823.             if((_loc41_ = _loc38_ - _loc37_ * _loc36_ / 100) > 0)
  824.             {
  825.                _loc38_ -= _loc41_;
  826.             }
  827.             do
  828.             {
  829.                _loc39_ = true;
  830.                _loc42_ = _loc38_ / _loc36_;
  831.                _loc22_ = 0;
  832.                _loc25_ = _loc23_;
  833.                _loc26_ = _loc24_;
  834.                _loc43_ = 0;
  835.                _loc17_ = 0;
  836.                while(_loc17_ < numChildren)
  837.                {
  838.                   if((_loc18_ = IUIComponent(getChildAt(_loc17_))).includeInLayout)
  839.                   {
  840.                      _loc27_ = _loc18_.getExplicitOrMeasuredWidth();
  841.                      _loc28_ = _loc18_.getExplicitOrMeasuredHeight();
  842.                      _loc29_ = _loc18_.percentWidth;
  843.                      _loc30_ = _loc18_.percentHeight;
  844.                      _loc19_ = Math.min(_loc15_,!isNaN(_loc29_) ? Number(_loc29_ * _loc16_ / 100) : Number(_loc27_));
  845.                      _loc19_ = Math.max(_loc18_.minWidth,Math.min(_loc18_.maxWidth,_loc19_));
  846.                      if(_loc40_[_loc17_] != -1)
  847.                      {
  848.                         _loc20_ = _loc40_[_loc17_];
  849.                      }
  850.                      else
  851.                      {
  852.                         if((_loc20_ = !isNaN(_loc30_) ? Number(_loc30_ * _loc42_) : Number(_loc28_)) < _loc18_.minHeight)
  853.                         {
  854.                            _loc20_ = _loc18_.minHeight;
  855.                            _loc36_ -= _loc18_.percentHeight;
  856.                            _loc38_ -= _loc20_;
  857.                            _loc40_[_loc17_] = _loc20_;
  858.                            _loc39_ = false;
  859.                            break;
  860.                         }
  861.                         if(_loc20_ > _loc18_.maxHeight)
  862.                         {
  863.                            _loc20_ = _loc18_.maxHeight;
  864.                            _loc36_ -= _loc18_.percentHeight;
  865.                            _loc38_ -= _loc20_;
  866.                            _loc40_[_loc17_] = _loc20_;
  867.                            _loc39_ = false;
  868.                            break;
  869.                         }
  870.                      }
  871.                      if(_loc18_.scaleX == 1 && _loc18_.scaleY == 1)
  872.                      {
  873.                         _loc18_.setActualSize(Math.floor(_loc19_),Math.floor(_loc20_));
  874.                      }
  875.                      else
  876.                      {
  877.                         _loc18_.setActualSize(_loc19_,_loc20_);
  878.                      }
  879.                      _loc44_ = (_loc15_ - _loc18_.width) * _loc10_;
  880.                      _loc18_.move(Math.floor(_loc25_ + _loc44_),Math.floor(_loc26_));
  881.                      _loc43_ = Math.max(_loc43_,_loc18_.height);
  882.                      if(++_loc22_ >= _loc21_)
  883.                      {
  884.                         _loc25_ = _loc23_;
  885.                         _loc22_ = 0;
  886.                         _loc26_ += _loc43_ + _loc7_;
  887.                         _loc43_ = 0;
  888.                      }
  889.                      else
  890.                      {
  891.                         _loc25_ += _loc15_ + _loc6_;
  892.                      }
  893.                   }
  894.                   _loc17_++;
  895.                }
  896.             }
  897.             while(!_loc39_);
  898.             
  899.          }
  900.       }
  901.       
  902.       [Bindable("labelChanged")]
  903.       override public function get label() : String
  904.       {
  905.          return _label;
  906.       }
  907.       
  908.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  909.       {
  910.          var _loc7_:IUIComponent = null;
  911.          var _loc8_:Number = NaN;
  912.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  913.          {
  914.             previousUpdateDisplayList(param1,param2);
  915.             return;
  916.          }
  917.          super.updateDisplayList(param1,param2);
  918.          if(direction == FormItemDirection.VERTICAL)
  919.          {
  920.             updateDisplayListVerticalChildren(param1,param2);
  921.          }
  922.          else
  923.          {
  924.             updateDisplayListHorizontalChildren(param1,param2);
  925.          }
  926.          var _loc3_:EdgeMetrics = viewMetricsAndPadding;
  927.          var _loc4_:Number = _loc3_.left;
  928.          var _loc5_:Number = _loc3_.top;
  929.          var _loc6_:Number = calculateLabelWidth();
  930.          if(numChildren > 0)
  931.          {
  932.             _loc8_ = (_loc7_ = IUIComponent(getChildAt(0))).baselinePosition;
  933.             if(!isNaN(_loc8_))
  934.             {
  935.                _loc5_ += _loc8_ - labelObj.baselinePosition;
  936.             }
  937.          }
  938.          labelObj.setActualSize(_loc6_,labelObj.getExplicitOrMeasuredHeight());
  939.          labelObj.move(_loc4_,_loc5_);
  940.          _loc4_ += _loc6_;
  941.          displayIndicator(_loc4_,_loc5_);
  942.       }
  943.       
  944.       private function calculateLabelWidth() : Number
  945.       {
  946.          var _loc1_:Number = getStyle("labelWidth");
  947.          if(_loc1_ == 0)
  948.          {
  949.             _loc1_ = NaN;
  950.          }
  951.          if(isNaN(_loc1_) && parent is Form)
  952.          {
  953.             _loc1_ = Form(parent).calculateLabelWidth();
  954.          }
  955.          if(isNaN(_loc1_))
  956.          {
  957.             _loc1_ = getPreferredLabelWidth();
  958.          }
  959.          return _loc1_;
  960.       }
  961.       
  962.       private function measureVertical() : void
  963.       {
  964.          var _loc2_:Number = NaN;
  965.          mx_internal::verticalLayoutObject.measure();
  966.          var _loc1_:Number = calculateLabelWidth() + getStyle("indicatorGap");
  967.          measuredMinWidth += _loc1_;
  968.          measuredWidth += _loc1_;
  969.          _loc2_ = labelObj.getExplicitOrMeasuredHeight();
  970.          measuredMinHeight = Math.max(measuredMinHeight,_loc2_);
  971.          measuredHeight = Math.max(measuredHeight,_loc2_);
  972.       }
  973.       
  974.       public function set direction(param1:String) : void
  975.       {
  976.          _direction = param1;
  977.          invalidateSize();
  978.          invalidateDisplayList();
  979.          dispatchEvent(new Event("directionChanged"));
  980.       }
  981.       
  982.       [Bindable("directionChanged")]
  983.       public function get direction() : String
  984.       {
  985.          return _direction;
  986.       }
  987.    }
  988. }
  989.